{
  "cells": [
    {
      "cell_type": "markdown",
      "id": "59407eaf",
      "metadata": {},
      "source": [
        "# ExpressionFactor\n",
        "\n",
        "## Overview\n",
        "\n",
        "The `ExpressionFactor` class in GTSAM is a template class designed to work with factor graphs in the context of nonlinear optimization. It represents a factor that can be constructed from a [GTSAM expression](../../../doc/expressions.md), allowing for flexible and efficient computation of error terms in optimization problems.\n",
        "\n",
        "The `ExpressionFactor` class allows users to define factors based on expressions in C++, that use (reverse) automatic differentiation to compute their Jacobians.\n",
        "\n",
        "## Main Methods\n",
        "\n",
        "### Constructor\n",
        "\n",
        "The `ExpressionFactor` class provides a constructor that allows for the initialization of the factor with a specific expression and measurement:\n",
        "\n",
        "```cpp\n",
        "  /**\n",
        "   * Constructor: creates a factor from a measurement and measurement function\n",
        "   *   @param noiseModel the noise model associated with a measurement\n",
        "   *   @param measurement actual value of the measurement, of type T\n",
        "   *   @param expression predicts the measurement from Values\n",
        "   * The keys associated with the factor, returned by keys(), are sorted.\n",
        "   */\n",
        "  ExpressionFactor(const SharedNoiseModel& noiseModel,  //\n",
        "                   const T& measurement, const Expression<T>& expression)\n",
        "      : NoiseModelFactor(noiseModel), measured_(measurement) {\n",
        "    initialize(expression);\n",
        "  }\n",
        "```"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "colab_button",
      "metadata": {},
      "source": [
        "<a href=\"https://colab.research.google.com/github/borglab/gtsam/blob/develop/gtsam/nonlinear/doc/ExpressionFactor.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "license_cell",
      "metadata": {
        "tags": [
          "remove-cell"
        ]
      },
      "source": [
        "GTSAM Copyright 2010-2022, Georgia Tech Research Corporation,\nAtlanta, Georgia 30332-0415\nAll Rights Reserved\n\nAuthors: Frank Dellaert, et al. (see THANKS for the full author list)\n\nSee LICENSE for the license information"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "colab_import",
      "metadata": {
        "tags": [
          "remove-cell"
        ]
      },
      "outputs": [],
      "source": [
        "try:\n    import google.colab\n    %pip install --quiet gtsam-develop\nexcept ImportError:\n    pass"
      ]
    }
  ],
  "metadata": {
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}